﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Parser.VBLanguageCharacteristics
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Collections.Generic;
using System.Web.Razor.Parser.SyntaxTree;
using System.Web.Razor.Text;
using System.Web.Razor.Tokenizer;
using System.Web.Razor.Tokenizer.Symbols;

namespace System.Web.Razor.Parser
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the characteristics of the Visual Basic language.</summary>
  public class VBLanguageCharacteristics : 
    LanguageCharacteristics<VBTokenizer, VBSymbol, VBSymbolType>
  {
    private static readonly VBLanguageCharacteristics _instance = new VBLanguageCharacteristics();

    private VBLanguageCharacteristics()
    {
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets an instance of this <see cref="T:System.Web.Razor.Parser.VBLanguageCharacteristics" />.</summary>
    /// <returns>An instance of <see cref="T:System.Web.Razor.Parser.VBLanguageCharacteristics" />.</returns>
    public static VBLanguageCharacteristics Instance => VBLanguageCharacteristics._instance;

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Creates a Visual Basic tokenizer.</summary>
    /// <returns>The created <see cref="T:System.Web.Razor.Tokenizer.VBTokenizer" />.</returns>
    /// <param name="source">The source where to create the tokenizer.</param>
    public override VBTokenizer CreateTokenizer(ITextDocument source) => new VBTokenizer(source);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets a sample symbol with the given type.</summary>
    /// <returns>A sample symbol with the given type.</returns>
    /// <param name="type">The type of the symbol.</param>
    public override string GetSample(VBSymbolType type) => VBSymbol.GetSample(type);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Flips the given bracket.</summary>
    /// <returns>The type of the Visual Basic symbol.</returns>
    /// <param name="bracket">The bracket to flip.</param>
    public override VBSymbolType FlipBracket(VBSymbolType bracket)
    {
      switch (bracket)
      {
        case VBSymbolType.LeftParenthesis:
          return VBSymbolType.RightParenthesis;
        case VBSymbolType.RightBrace:
          return VBSymbolType.LeftBrace;
        case VBSymbolType.LeftBrace:
          return VBSymbolType.RightBrace;
        case VBSymbolType.RightParenthesis:
          return VBSymbolType.LeftParenthesis;
        case VBSymbolType.RightBracket:
          return VBSymbolType.LeftBracket;
        case VBSymbolType.LeftBracket:
          return VBSymbolType.RightBracket;
        default:
          return VBSymbolType.Unknown;
      }
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Creates a Visual Basic marker symbol.</summary>
    /// <returns>The created Visual Basic marker symbol.</returns>
    /// <param name="location">The location to create the symbol.</param>
    public override VBSymbol CreateMarkerSymbol(SourceLocation location) => new VBSymbol(location, string.Empty, VBSymbolType.Unknown);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Retrieves the type of the known symbol.</summary>
    /// <returns>The type of the known symbol.</returns>
    /// <param name="type">The type to retrieve.</param>
    public override VBSymbolType GetKnownSymbolType(KnownSymbolType type)
    {
      switch (type)
      {
        case KnownSymbolType.WhiteSpace:
          return VBSymbolType.WhiteSpace;
        case KnownSymbolType.NewLine:
          return VBSymbolType.NewLine;
        case KnownSymbolType.Identifier:
          return VBSymbolType.Identifier;
        case KnownSymbolType.Keyword:
          return VBSymbolType.Keyword;
        case KnownSymbolType.Transition:
          return VBSymbolType.Transition;
        case KnownSymbolType.CommentStart:
          return VBSymbolType.RazorCommentTransition;
        case KnownSymbolType.CommentStar:
          return VBSymbolType.RazorCommentStar;
        case KnownSymbolType.CommentBody:
          return VBSymbolType.RazorComment;
        default:
          return VBSymbolType.Unknown;
      }
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Creates a Visual Basic symbol.</summary>
    /// <returns>The created <see cref="T:System.Web.Razor.Tokenizer.Symbols.VBSymbol" />.</returns>
    /// <param name="location">The location to create the symbol.</param>
    /// <param name="content">The content.</param>
    /// <param name="type">The type of the symbol.</param>
    /// <param name="errors">The errors.</param>
    protected override VBSymbol CreateSymbol(
      SourceLocation location,
      string content,
      VBSymbolType type,
      IEnumerable<RazorError> errors)
    {
      return new VBSymbol(location, content, type, errors);
    }
  }
}
